package com.huawei.esdk.tp.domain.model;

import java.util.List;

import com.huawei.esdk.platform.common.SDKErrorCode;
import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.platform.common.exception.SDKException;
import com.huawei.esdk.tp.common.constants.TPConstant;
import com.huawei.esdk.tp.device.smc.IConferenceControlCapability;
import com.huawei.esdk.tp.device.smc.v100r002c01.SMC20V1R2C01IConferenceControlCapability;
import com.huawei.esdk.tp.device.smc.v100r003c10.SMC20V1R3C10IConferenceControlCapability;
import com.huawei.esdk.tp.device.smc.v100r003c10.SMC20V1R3C10IConferenceManagerCapability;
import com.huawei.esdk.tp.domain.model.bean.AudioControlSwitch;
import com.huawei.esdk.tp.domain.model.bean.ContinuousPresenceCapability;
import com.huawei.esdk.tp.domain.model.bean.ContinuousPresenceParam;

/**
 * 正在召开的会议
 * 
 * @author j00160659
 * 
 */
public class HoldingConference extends Conference
{
    
    public HoldingConference(String id)
    {
        super(id);
    }
    
    /**
     * @param siteUri
     * @return
     * @see SMC:ConnectSites
     */
    public SDKErrorCode connectSite(String siteUri)
    {
        return new SDKErrorCode();
    }
    
    /**
     * @param siteUri
     * @return
     * @see SMC:DisconnectSites
     */
    public SDKErrorCode disconnectSite(String siteUri)
    {
        return new SDKErrorCode();
    }
    
    /**
     * @param chairmanId
     * @param type
     * @param reqTalkIds
     * @return
     * @see SITE:WEB_CancelReqTalkListAPI
     */
    public SDKErrorCode cancelReqTalk(String chairmanId, int type, List<String> reqTalkIds)
    {
        return new SDKErrorCode();
    }
    
    /**
     * @param siteUri
     * @param videoSrcSiteUri
     * @param isLock
     * @return
     * @throws SDKException 
     * @see SMC:SetVideoSource
     */
    public SDKErrorCode setVideoSourceOfSite(String siteUri, String videoSrcSiteUri, boolean isLock)
        throws SDKException
    {
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        SDKErrorCode errorCode = confCtrl.setVideoSource(getId(), siteUri, videoSrcSiteUri, isLock);
        return errorCode;
    }
    
    /**
     * @param param
     * @return
     * @see SMC:SetAudioSwitch
     */
    public SDKErrorCode setAudioSwitchParam(AudioControlSwitch param)
    {
        return new SDKErrorCode();
    }
    
    /**
     * @param boardcastSiteUri
     * @return
     * @see SMC:SetBroadcast
     */
    public SDKErrorCode startBoardcast(String boardcastSiteUri)
    {
        return new SDKErrorCode();
    }
    
    /**
     * @return
     * @see SMC:CancelBroadcast
     */
    public SDKErrorCode stopBoardcast()
    {
        return new SDKErrorCode();
    }
    
    /**
     * @param modifySites
     * @param isMute
     * @return
     * @SMC:MuteSites
     */
    public SDKErrorCode setMute(List<String> modifySites, boolean isMute)
    {
        return new SDKErrorCode();
    }
    
    /**
     * @param modifySites
     * @param isQuiet
     * @return
     * @see SMC:QuietSites
     */
    public SDKErrorCode setQuiet(List<String> modifySites, boolean isQuiet)
    {
        return new SDKErrorCode();
    }
    
    /**
     * @return
     * @see SITE:WEB_ConfFreeTalkAPI
     */
    public SDKErrorCode setFreeTalk()
    {
        return null;
    }
    
    /**
     * 添加会场到已召开的会议
     * @throws SDKException 
     */
    public SDKErrorCode addSite(Site site)
        throws SDKException
    {
        
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        SDKErrorCode result = confCtrl.addSiteToConf(getId(), site);
        return result;
    }
    
    /**
     * 医疗接口 
     * 设置已召开的会议的声控转换
     * @throws SDKException 
     */
    public SDKErrorCode setAudioSwitch(Boolean onOff)
        throws SDKException
    {
        
        SDKErrorCode result = null;
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        
        result = confCtrl.setAudioSwitch(this.getId(), onOff);
        
        return result;
    }
    
    /**
     * 从已召开的会议中删除会场
     * @throws SDKException 
     */
    public SDKErrorCode delSiteFromConf(String siteUri)
        throws SDKException
    {
        SDKErrorCode result = null;
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        
        result = confCtrl.delSiteFromConf(this.getId(), siteUri);
        
        return result;
    }
    
    public SDKErrorCode setAudioSwitchEX(boolean enable, Integer swtichGate)
        throws SDKException
    {
        SDKErrorCode result = null;
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        
        result = confCtrl.setAudioSwitchEX(this.getId(), enable, swtichGate);
        
        return result;
    }
    
    public SDKErrorCode setBroadcastSiteEx(String siteUri)
        throws SDKException
    {
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.setBroadcastSiteEx(this.getId(), siteUri);
        
        return result;
    }
    
    public SDKErrorCode cancelBroadcastSiteEx(String siteUri)
        throws SDKException
    {
        SMC20V1R2C01IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R2C01IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.cancelBroadcastSiteEx(this.getId(), siteUri);
        
        return result;
    }
    
    public SDKErrorCode setBroadcastContinuousPresenceEx()
        throws SDKException
    {
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.setBroadcastContinuousPresenceEx(this.getId());
        
        return result;
    }
    
    public SDKErrorCode cancelBroadcastContinuousPresenceEx()
        throws SDKException
    {
        SMC20V1R2C01IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R2C01IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.cancelBroadcastContinuousPresenceEx(this.getId());
        
        return result;
    }
    
    public SDKErrorCode setContinuousPresenceEx(ContinuousPresenceParam continuousPresenceParam)
        throws SDKException
    {
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.setContinuousPresenceEx(this.getId(), continuousPresenceParam);
        
        return result;
    }
    
    public SDKResult<ContinuousPresenceCapability> getContinuousPresenceInfoEx()
        throws SDKException
    {
        IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC, IConferenceControlCapability.class);
        
        SDKResult<ContinuousPresenceCapability> result = confCtrl.getContinuousPresenceInfoEx(this.getId());
        
        return result;
    }
    
    public SDKResult<ContinuousPresenceParam> getContinuousPresenceParamEx(String target)
        throws SDKException
    {
        SMC20V1R3C10IConferenceManagerCapability confMgr =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R3C10IConferenceManagerCapability.class);
        
        SDKResult<ContinuousPresenceParam> result = confMgr.getContinuousPresenceParamEx(this.getId(), target);
        
        return result;
    }
    
    public SDKErrorCode unlockPresentationEx() throws SDKException
    {
        SMC20V1R3C10IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R3C10IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.unlockPresentation(this.getId());
        
        return result;
    }

    public SDKErrorCode lockPresentationEx(String siteUri) throws SDKException
    {
        SMC20V1R3C10IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R3C10IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.lockPresentation(this.getId(), siteUri);
        
        return result;
    }
    
    public SDKErrorCode requestConfChairEx(String chairmanUri) throws SDKException
    {
        SMC20V1R3C10IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R3C10IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.requestConfChairEx(this.getId(), chairmanUri);
        return result;
    }
    
    public SDKErrorCode releaseConfChairEx() throws SDKException
    {
        SMC20V1R3C10IConferenceControlCapability confCtrl =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R3C10IConferenceControlCapability.class);
        
        SDKErrorCode result = confCtrl.releaseConfChairEx(this.getId());
        return result;
    }
}
